<?php
	require 'sessionInfo.class.php' ;
	SessionInfo::checkAdminLogin();
	require 'sql.class.php' ;
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" type="text/css" href="/mcnews/css/admin.css">
</head>

</div>

<div class="menu">
	<ul>
		<li><a href="member.php">用户管理</a></li>
		<li><a href="class.php">文章分类</a></li>
		<li style="background-color: white;"><a href="content.php">文章管理</a></li>
		<li><a href="loginout.php">退出</a></li>

	</ul>
</div>

<div class="rightContent" id="rightContent">
	<div class="addMember">添加文章
		<form action="contentaction.php?type=0" method="POST" enctype="multipart/form-data">
			分类:<input type="text" name="classId">
			标题:<input type="text" name="title">
			内容:<input type="text" name="content">
			用户id:<input type="text" name="memberId">
			创建时间:<input type="text" name="createTime">
			缩略图:<input type="file" name="thumb">
			<br/>
			<input type="submit" name="" value="添加">
		</form>
	</div>

	<br/>
	<div class="memberList">查看文章
		<ul>
		<li style="clear: both; overflow: hidden;">
			<span class="memberLabel"></span>
			<span class="memberLabel"></span>
			<span class="memberLabel">id</span>
			<span class="memberLabel">classId</span>
			<span class="memberLabel">title</span>
			<span class="memberLabel">content</span>
			<span class="memberLabel">memberId</span>
			<span class="memberLabel">createTime</span>
			<span class="memberLabel">thumb</span>
		</li>
		<?php
			$arr = getContentInfo();
			$h = "";
			foreach ($arr as $key => $dic) {
				$id = $dic["id"];
				$classId = $dic["classId"];
				$title = $dic["title"];
				$content = $dic["content"];
				$memberId = $dic["memberId"];
				$createTime = $dic["createTime"];
				$thumb = $dic["thumb"];

				$par = "?id=" . $id . "&classId=" . $classId . "&title=" . $title . "&content=" . $content . "&memberId=" . $memberId . "&createTime=" . $createTime . "&thumb=" . $thumb . "";

				$style = "memberLabelLightGray";
				if ($key % 2 == 0) {
					$style = "memberLabelDarkGray";
				} 
				$h .= "
					<li style='clear: both; overflow: hidden;''>
						<span class='".$style."'><a href='contentedit.php". $par ."'>修改</a></span>
						<span class='".$style."'><a href='contentaction.php?id=". $id ."&type=2'>删除</a></span>
						<span class='".$style."'>" . $id . "</span>
						<span class='".$style."'>" . $classId . "</span>
						<span class='".$style."'>" . $title . "</span>
						<span class='".$style."'>" . $content . "</span>
						<span class='".$style."'>" . $memberId . "</span>
						<span class='".$style."'>" . $createTime . "</span>
						<span class='".$style."'>" . $thumb . "</span>
					</li>
				";
			}
			echo $h;
		?>
		</ul>
	</div>
</div>
<script type="text/javascript">
	var windowWidth = document.body.scrollWidth;
	var rightContent = windowWidth - 170 ;
	var windowHeight = document.body.clientHeight;
	document.getElementById("rightContent").style.width=rightContent + "px";
	document.getElementById("rightContent").style.height=windowHeight + "px";

	window.onresize=function(){  
	    var windowWidth = document.body.scrollWidth;
		var rightContent = windowWidth - 170 ;
		var windowHeight = document.body.clientHeight;

		document.getElementById("rightContent").style.width=rightContent + "px";
		document.getElementById("rightContent").style.height=windowHeight + "px";
    }  

</script>

</body>
</html>